#include "RandomAI.h"

#include "Monster.h"


RandomAI::RandomAI(const Monster& monster, const Map& map):
	MonsterAI(monster, map)
{
}


RandomAI::~RandomAI()
{
}


void RandomAI::getMove(int& hDirection, int& vDirection) const
{
	// Query current location and direction
	int currentHDirection, currentVDirection;
	monster.getVelocity(currentHDirection, currentVDirection);
	int currentX, currentY;
	monster.getLocation(currentX, currentY);
	// Randomly choose betwee current direction or the four other directions
	hDirection = currentHDirection;
	vDirection = currentVDirection;
	if (rand() % 4 != 0)
	{
		getRandomOtherValidDirection(currentX, currentY, hDirection, vDirection);
	}
}